from add_ps_psd_back_ilp import AddPSPSD
from QKDNetwork import QKDNetwork
import numpy as np
from concurrent.futures import ThreadPoolExecutor

# 

def experiment(num_node, sd_num, alpha):
    net = QKDNetwork(showTopology=False, num_node=num_node, sd_num=sd_num, alpha=0.35, hete=True)
    mu = 0.5
    a = AddPSPSD(net, mu)
    su_indices, pvn_indices, e_indices = a.lp()
    print([len(su_indices), len(pvn_indices)])

for node_num in range(20, 60, 10):
    for mu in np.arange(0, 1.0, 0.2):
        print("node_num: ", node_num, "mu: ", mu)
        with ThreadPoolExecutor(max_workers=20) as executor:
            futures = [executor.submit(experiment, node_num, 30, mu) for _ in range(20)]
            for future in futures:
                future.result()  # Wait for all threads to complete


